package com.hoki.zj.hrm.doc;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

@Document(indexName = "test", type = "course")
@Data
public class CourseDoc {

    /**
     * 索引id
     * 课程id
     */
    @Id
    private Long id;

    /**
     * 课程名,指定分词器
     */
    @Field(type = FieldType.Text, analyzer = "ik_max_word",searchAnalyzer = "ik_max_word")
    private String name;

    /**
     * 使用人群,不分词
     */
    @Field(type = FieldType.Keyword)
    private String forUser;

    /**
     * 分类,不分词
     */
    @Field(type = FieldType.Long)
    private Long courseTypeId;

    /**
     * 等级,不分词
     */
    @Field(type = FieldType.Keyword)
    private String gradeName;

    /**
     * 机构
     */
    @Field(type = FieldType.Keyword)
    private String tenantName;

    /**
     * 封面
     */
    @Field(index = false, type = FieldType.Keyword)
    private String pic;

    /**
     * 销量
     */
    @Field(type = FieldType.Keyword)
    private Integer saleCount;

    /**
     * 浏览量
     */
    @Field(type = FieldType.Keyword)
    private Integer viewCount;

    /**
     * 评论数
     */
    @Field(type = FieldType.Keyword)
    private Integer commentCount;

    /**
     * 发布时间,手动设置
     */
    @Field(type = FieldType.Date)
    private Date publishTime;

    /**
     * 收费规则：，收费1免费，2收费
     */
    @Field(type = FieldType.Keyword)
    private String charge;

    /**
     * 价格
     */
    @Field(type = FieldType.Float)
    private Float price;
    /**
     * 原价
     */
    @Field(type = FieldType.Float)
    private Float priceOld;
}